package com.fr.report.highlight;

import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.report.CellElement;
import com.fr.report.io.xml.ReportXMLUtils;
import com.fr.report.script.Calculator;
import com.fr.report.web.ui.Widget;

public class WidgetHighlightAction extends AbstractHighlightAction
{
  private Widget widget;

  public WidgetHighlightAction()
  {
  }

  public WidgetHighlightAction(Widget paramWidget)
  {
    this.widget = paramWidget;
  }

  public void action(CellElement paramCellElement, Calculator paramCalculator)
  {
    if (paramCellElement == null)
      return;
    if (this.widget == null)
    {
      paramCellElement.setWidget(null);
    }
    else
    {
      Widget localWidget = this.widget;
      try
      {
        localWidget = (Widget)this.widget.clone();
      }
      catch (CloneNotSupportedException localCloneNotSupportedException)
      {
      }
      paramCellElement.setWidget(localWidget);
    }
  }

  public Widget getWidget()
  {
    return this.widget;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      String str = paramXMLableReader.getTagName();
      if ("Widget".equals(str))
        this.widget = ReportXMLUtils.readWidget(paramXMLableReader);
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    ReportXMLUtils.writeXMLable(paramXMLPrintWriter, this.widget, "Widget");
  }
}